package org.example.school.entity;

import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import java.time.LocalDateTime;
import java.io.Serializable;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

/**
 * <p>
 * 用户表
 * </p>
 *
 * @author author
 * @since 2025-09-28
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("users")
public class Users implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 用户唯一ID
     */
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    /**
     * 用户名/登录账号
     */
    private String username;

    /**
     * 加密后的密码
     */
    private String passwordHash;

    /**
     * 手机号，可用于登录或接收通知
     */
    private String phoneNumber;

    /**
     * 用户类型(1:教师端, 2:学生，3家长)
     */
    private String userType;

    /**
     * 账户状态 (1:正常, 0:禁用)
     */
    private Boolean status;

    /**
     * 创建时间
     */
    private LocalDateTime createdAt;

    /**
     * 更新时间
     */
    private LocalDateTime updatedAt;


    public Users(){

    }

    public Users(String username,String passwordHash,String userType) {
        this.username = username;
        this.passwordHash = passwordHash;
       this.status = true;
       this.createdAt = LocalDateTime.now();
       this.updatedAt = LocalDateTime.now();
        this.userType = userType; // 从参数获取
    }



}
